class SolutionZsh {
    public int uniquePaths(int m, int n) {
        int[] cache = new int[m];
        for (int i = 0, cache[0] = 1; i < n; i++)
            for (int j = 1; j < m; j++) 
                cache[j] += cache[j - 1];
        return cache[m - 1];
    }
}